#include <stdint.h>
#include <stdlib.h>

#define NIT_SHORT_NAMES
#include <nit/list.h>
#include <nit/hset.h>
#include <nit/hmap.h>
#include <nit/radix.h>
#include <nit/vec.h>

#define ANO_SHORT_NAMES
#include <ano.h>

#include "cr8.h"

int
cr8_syn_val_bind(Nit_radix *syn_radix, Nit_radix *val_radix,
		 void *syn, size_t size, Cr8_val *val)
{
	if (!radix_insert(syn_radix, syn, size, val))
		return 0;

	return radix_insert(val_radix, &val->id, sizeof(val->id), syn);
}

int
cr8_syn_ano_vals(Ano_tscan *scan, Ano_ano *syn_ano, Ano_reverb *reverb,
		 Cr8_vals *vals)
{
	foreach (vals)
		if (!tscan_scan_unit(scan, syn_ano, reverb,
				     &vals->val->id, sizeof(vals->val->id)))
			return 0;

	return 1;
}
